#!/bin/bash
# chkconfig: 345 98 20
# description: nifi
# processname: nifi
dir="/opt/nifi/current/bin"
RUN_AS_USER=nifi

case "$1" in
    start)
    cd "$dir"
    su - $RUN_AS_USER -c "$dir/nifi.sh start"
    ;;
    stop)
    cd "$dir"
    su - $RUN_AS_USER -c "$dir/nifi.sh stop"
    ;;
    restart)
    su - $RUN_AS_USER -c "$dir/nifi.sh restart"
    ;;
    status)
    su - $RUN_AS_USER -c "$dir/nifi.sh status"
    ;;
    *)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 1
    ;;
esac

exit 0